package com.xiaoshuidi.cloud.module.member.controller.admin.coupon.vo;

import com.xiaoshuidi.cloud.framework.common.pojo.PageParam;
import com.xiaoshuidi.cloud.module.iot.uitils.DateformatUtils;
import com.xiaoshuidi.cloud.module.member.utils.DateUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;

@Data
public class CouponCustomerPageForm extends PageParam {

    @Schema(description = "优惠券名称")
    private String couponName;

    @Schema(description = "优惠券类型 1预定优惠|2老带新优惠|3新签约优惠|4 内部员工优惠|5其他优惠")
    private Integer couponType;

    @Schema(description = "客户手机号")
    private String userPhone;

    @Schema(description = "发券开始时间")
    private Date startTime;

    @Schema(description = "发券结束时间")
    private Date endTime;

    @Schema(description = "使用状态 1待使用 |2 已作废|3已使用|4已过期")
    private Integer usageStatus;

    public Date getStartTime() {
        if (startTime != null) {
            return DateUtils.parse(DateformatUtils.formatDate(startTime, "yyyy-MM-dd").concat(" 00:00:00"), DateUtils.DATE_TIME_PATTERN);
        }
        return null;
    }

    public Date getEndTime() {
        if (endTime != null) {
            return DateUtils.parse(DateformatUtils.formatDate(endTime, "yyyy-MM-dd").concat(" 23:59:59"), DateUtils.DATE_TIME_PATTERN);
        }
        return null;
    }
}
